package com.csdj.t309.papermanage.service;

import com.csdj.t309.papermanage.entity.TPaper;
import com.csdj.t309.papermanage.entity.TPaperExample;
import com.csdj.t309.papermanage.mapper.TPaperMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TpaperService implements ITpaperService{

    @Resource
    private TPaperMapper tPaperMapper;

    @Override
    public int insertTp(TPaper tPaper) {
        Integer num = tPaperMapper.insert(tPaper);
        if(num>0){
            return num;
        }else {
            return 0;
        }
    }

    @Override
    public List<TPaper> selTps() {
        TPaperExample tPaperExample = new TPaperExample();
        tPaperExample.createCriteria();
        List<TPaper> selTpas = tPaperMapper.selectByExample(tPaperExample);
        if(selTpas!=null){
            return selTpas;
        }
        return null;
    }

    @Override
    public List<TPaper> selTp() {
        return null;
    }

    @Override
    public int delTp(Integer id) {
        Integer result = tPaperMapper.deleteByPrimaryKey(id);
        if(result>0){
            return result;
        }
        return 0;
    }

    @Override
    public int update(Integer id) {
        return 0;
    }
}
